import requests
import taos
import pandas

config_td = {'host': 'cloud', 'database': 'dbmanager', 'port': 6030, 'user': 'root', 'password': 'taosdata'}

conn = taos.connect(database=config_td['database'],
                    user=config_td['user'],
                    password=config_td['password'],
                    host=config_td['host'],
                    port=config_td['port'])

task_id = 1
data_id = 1
cols = ['t', 'x', 'y']
# 如有中文/大写列名，需要在列名加``，
sql = f"select `{cols[0]}`,`{cols[1]}`,`{cols[2]}` from task_{task_id}_data_{data_id}"
cursor = conn.cursor()
cursor.execute(sql)

# 转换为pandas.DataFrame
df = pandas.DataFrame(cursor.fetchall(), columns=cols)
print(df)
conn.close()